<!DOCTYPE html>
<html>
   <head>
     <title>Astrium Mobile Application</title>
         <meta charset="utf-8">
      <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />
      <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
      <script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
 </head>
 <body>
	<?php
	
		if($_POST['del'] != "")
		{
		     	$folder = "/tmp/rep.txt";
	                $folder1 = "/tmp/rep1.txt";
                        $folder2 = "/tmp/crontab";

			$pattern = $_POST['del'];
			//$del = "\\";
                       // $pattern = $del.$pattern;
			$path = $_POST['path'];
			$date = $_POST['date'];
			$level = $_POST['level'];
			$appli = $_POST['appli'];
			$mes = $_POST['mes'];

	        	$ligne =$pattern. " ". $path. " ". $date. " ". $level. " ". $appli. " ". $mes."\n";
			$rep = fopen($folder1, "a");
			fputs($rep,$ligne);
			fclose($rep);
			$rep1 = fopen($folder, "a");
                        fputs($rep1, $ligne);
			fclose($rep1);
 

			$dir = fopen("/tmp/crontab", "w");
			$rule = "* * * * * /usr/bin/php /var/www/scale-paas/astrium/script.php > /tmp/error \n";
			fputs($dir, $rule);
			fclose($dir);
			shell_exec("crontab /tmp/crontab");
			//sleep(45);
	?>

			<script LANGUAGE="JavaScript">
                		document.location.href="logs.html";   
        		 </script>
	<?php

		}	

?>
 </body>
</html>
